home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather
- Path: in2.uu.net!allegra!alice!bs
- From: bs@research.att.com (Bjarne Stroustrup <9758-26353> 0112760)
- Subject: Re: What Should An Exception Handling Do? -- Clarification of rules
- Message-ID: <Doq3sv.MzA@research.att.com>
- Organization: Info. Sci. Div., AT&T Bell Laboratories, Murray Hill, NJ
- References: <4irn11$7ln@mimas.brunel.ac.uk> <Pine.Sola.3.91.960322041345.17711C-100000@ux5.cso.uiuc.edu> <4j03p4$fbt@hoho.quake.net>
- Date: Sat, 23 Mar 1996 13:50:55 GMT
-
- billf@jovial.com (Bill Foote) writes
-
-
- > > quote explaining why C++ (and Java) uses the termination model
- > > of exception handling
- >
- > A cynic might conclude something more along these lines: "It would be hard
- > to implement resumable exceptions in C++, so they decided to punt."
-
- and that "cynic" would be wrong, guilty of not having done his homework,
- and guilty of making unkind conjectures without basis in facts.
-
- > It's not too hard to come up with examples where it would be nice to have
- > resumable exceptions. One example is resource acquisition. Upon failure
- > to acquire a resource (a file descriptor, some memory, etc.) it might be
- > nice if a top-level exception handler could try to free up some resources,
- > and if it can, try to resume from the exception.
-
- This point, and many others were seriously studied by the C++ standards
- committee before it approved my design of exception handling for C++.
- The arguments for and against resumption can be found in chapter 16 of
-
- Bjarne Stroustrup:
- The Design and Evolution of C++
- Addison-Wesley ISBN 0-201-54330-3
-
- together with a description of the complete language features and examples
- of their use.
-
- Here, I'd like to quote a key section:
-
- Then, at the Palo Alto meeting in November 1991, we heard a
- brilliant summary of the arguments for termination semantics
- backed with both personal experience and data from Jim Mitchell
- (from Sun, formerly from Xerox PARC). Jim had used exception
- handling in half a dozen languages over a period of 20 years
- and was an early proponent of resumption semantics as one of
- the main designers and implementers of Xerox's Cedar/Mesa system.
- His message was
-
- ``termination is preferred over resumption; this is
- not a matter of opinion but a matter of years of
- experience. Resumption is seductive, but not valid.''
-
- He backed this statement with experience from several operating
- systems. The key example was Cedar/Mesa: It was written by people
- who liked and used resumption, but after ten years of use, there
- was only one use of resumption left in the half million line
- system -- and that was a context inquiry. Because resumption
- wasn't actually necessary for such a context inquiry, they removed
- it and found a significant speed increase in that part of the
- system. In each and every case where resumption had been used
- it had -- over the ten years -- become a problem and a more
- appropriate design had replaced it. Basically, every use of
- resumption had represented a failure to keep separate levels
- of abstraction disjoint
-
- Mary Fontana presented similar data from the TI Explorer system
- where resumption was found to be used for debugging only, Aron
- Insinga presented evidence of the very limited and nonessential
- use of resumption in DEC's VMS, and Kim Knuttilla related exactly
- the same story as Jim Mitchell for two large and long-lived
- projects inside IBM. To this we added a strong opinion in favor
- of termination based on experience at L.M.Ericsson relayed to
- us by Dag Bruck.
-
- Thus, the C++ committee endorsed termination semantics.
-
- > Oh well.
-
- Indeed
-
- - Bjarne
-
-